/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package elderberryni2.data.container;

import elderberryni2.abstracts.BaseTimestampable;
import elderberryni2.interfaces.IDumpable;

/**
 *
 * @author warringer
 */
public class RotationContainer extends BaseTimestampable<Float>
    implements Comparable<RotationContainer>, IDumpable {

    private float roll;
    private float pitch;
    private float yaw;

    /**
     * 
     * @param roll
     * @param pitch
     * @param yaw
     * @param timestamp
     */
    public RotationContainer(float roll, float pitch, float yaw, float timestamp) {
        this.roll = roll;
        this.pitch = pitch;
        this.yaw = yaw;
        this.setTimestamp(timestamp);
    }

    /**
     * 
     * @return
     */
    public float getPitch() {
        return pitch;
    }

    /**
     * 
     * @return
     */
    public float getRoll() {
        return roll;
    }

    /**
     * 
     * @return
     */
    public float getYaw() {
        return yaw;
    }
    
    @Override
    public Float getTimestampDifference(Float timestamp) {
        return Math.abs(this.getTimestamp() - timestamp);
    }

    /**
     * 
     * @param t
     * @return
     */
    @Override
    public int compareTo(RotationContainer t) {
        if (this.yaw == t.getYaw() && 
                this.roll == t.getRoll() &&
                this.pitch == t.getPitch()) {
            return 0;
        } else {
            return 1;
        }
    }

    @Override
    public String toCSV() {
        return new Float(pitch).toString() 
                + ";" + new Float(roll).toString() 
                + ";" + new Float(yaw).toString();
    }
    
    @Override
    public String getHeader() {
        return "Pitch;Roll;Yaw";
    }
    
}
